<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>

<%@ include file="/WEB-INF/jsp/common/taglib.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>checkInfo_ADD</title>
<script src="<c:url value="/ui/jquery-1.10.2.js" />"></script>
<script src="<c:url value="/ui/jquery-migrate-1.2.1.js" />"></script>

<link rel="stylesheet" href="<c:url value="/demo/jquery.ui.all.css"/>">
<link href="<s:url value="/css/standard.css" />" rel="stylesheet"
	type="text/css" />
<link href="<s:url value="/css/pop_up.css" />" rel="stylesheet"
	type="text/css" />
<link href="<s:url value="/css/maintenance.css" />" rel="stylesheet"
	type="text/css" />
<link href="<s:url value="/css/Simplemodal.css" />" rel="stylesheet"
	type="text/css" />

<script src='<c:url value="/js/jquery.DynamicMessage.js" />'></script>
<script src='<c:url value="/js/jquery.simplemodal-1.4.1.js" />'></script>

<script src='<c:url value="/js/common.js" />'></script>
<script src='<c:url value="/js/common_ui.js" />'></script>
<script src='<c:url value="/js/poplayer.js" />'></script>
<script src='<c:url value="/js/maint_ui.js" />'></script>


<script src="<c:url value="/ui/jquery.ui.core.js" />"></script>
<script src="<c:url value="/ui/jquery.ui.widget.js" />"></script>
<script src="<c:url value="/ui/jquery.ui.datepicker.js" />"></script>
<script src="<c:url value="/ui/jquery-ui-timepicker-addon.js" />"></script>

<script src="<c:url value="/ui/jquery-ui-slide.min.js" />"></script>
<link rel="stylesheet" href="<c:url value="/demo/demos.css" />">
<link rel="stylesheet" href="<c:url value="/demo/dateTime.css" />">

<script type="text/javascript">
	$(function() {

		$('.example').datetimepicker({
			changeMonth : true,
			changeYear : true
		});

	})
</script>
</head>
<body id="overall">


	<form:form method="post" name="addForm" onsubmit="return doSubmit()">
		<table width="100%" border="0" cellspacing="0" cellpadding="0"
			class="problemDes">
			<tr>
				<td colspan="2" width="40%">
					<table cellspacing="2" cellpadding="2" border="0" width="100%">
						<tr>
							<td width="150px" class="labelText">员工名:</td>
							<td><input onmousedown="show_child()" name='employeeName'
								class="example2" id="employeeInfoName" readonly="readonly"
								value="${ checkInfo.employeeName }"></td>

						</tr>
						<tr>
							<td width="150px" class="labelText">员工性别:</td>
							<td><input onmousedown="show_child()" readonly="readonly"
								id='employeeInfoGrender' value="${ employeeInfo.grender }"></td>
						</tr>
						<tr>
							<td width="150px" class="labelText">签到时间:</td>
							<td><input type="text" class="example" name="chcekInTime"
								onclick="incheck()" id="chcekInTime"
								value="${checkInfo.chcekInTime }" /></td>

						</tr>

						<tr>
							<td width="150px" class="labelText">离开时间:</td>
							<td><input type="text" class="example" name="chcekOutTime"
								class="example2" id="chcekOutTime"
								value="${checkInfo.chcekOutTime }" />
							<td>
						</tr>
						<tr>
							<td width="150px" class="labelText">建立时间:</td>
							<td><input type="text" class="example" name="createdTime"
								class="example2" id="createdTime"
								value="${checkInfo.createdTime }" />
								<p id="allMessage" style="color: red"></p>
								<p id="checktime" style="color: red"></p>
								<p id="idcheck" style="color: red"></p></td>

						</tr>



						<input name='employeeInfoid' id="employeeInfoId" type="hidden"
							value="${employeeInfoid}" onmousedown="show_child()" />

					</table>
				</td>
				<td><img alt="头像"
					src="<c:url value ="/attachment/${attachmentId}/downLoad" />" width="250px"
					height="250px" id="img"><br><br></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<table>
						<tr>
							<td valign="top" class="buttonRow"><input type="submit"
								class="button" name="blGo2242" value=" 提交 " /></td>
							<td valign="top" class="buttonRow"><input type="button"
								value=" 返回 " class="button" name="blGo2242"
								onclick="toBack();" /></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>

	</form:form>

	<script type="text/javascript">
		$("input.example2").blur(function() {
			blurCheck();

		});
		$("input.example").blur(function() {
			blurCheck();
		});

		function blurCheck() {
			var id = $("#employeeInfoId").val().split("").length;
			var checkin = $("#chcekInTime").val().split("").length;
			var checkout = $("#chcekOutTime").val().split("").length;
			var creat = $("#createdTime").val().split("").length;

			if (id > 2 & checkin > 2 & checkout > 2 & creat > 2) {
				$("#allMessage").text("");
				$("#checktime").text("");
				$("#idcheck").text("");

			}
			if (creat > 2 & checkout > 2 & checkin > 2) {
				$("#checktime").text("");
			}
			if (id > 2) {
				$("#idcheck").text("");
				$("#allMessage").text("");
			}

		}

		function inspection() {
			var id = $("#employeeInfoId").val().split("").length;
			var checkin = $("#chcekInTime").val().split("").length;
			var checkout = $("#chcekOutTime").val().split("").length;
			var creat = $("#createdTime").val().split("").length;

			if (id < 1 & checkin < 1 & checkout < 1 & creat < 1) {
				$("#allMessage").text("所有信息能为必填");
				return false;
			} else {

				if (creat < 1 || checkout < 1 || checkin < 1) {
					$("#checktime").text("请输入时间");
				}
				if (id < 1) {
					$("#idcheck").text("员工不能为空");
				}

			}

			if (id > 2 & checkin > 2 & checkout > 2 & creat > 2) {
				return true;
			}

			return false;
		}

		function doSubmit() {
			var result = inspection();

			if (result) {

				addForm.action = "<c:url value='/checkinfo/add'/>";
				return true;

			} else {
				return false;
			}

			return false;
		}
		function toBack() {
			self.location = "<c:url value='/checkinfo/page'/>";
		}
		function show_child() {
			window.open("<c:url value='/employeeinfo/childpage'/>", "child",
					"height=500,width=1000,top=50,left=50");
		}
		
		function callBack(id,name,grender,attachmentId){
			
			$("#employeeInfoId").val(id);
			$("#employeeInfoName").val(name);
			$("#employeeInfoGrender").val(grender);
			$("#img").val(attachmentId);
			
			
			
		}
		
	</script>
</body>
</html>